#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import configparser
from conf import setting

conf = configparser.ConfigParser()
conf.read(setting.DB_PATH)

res = "创建成功"
# 数据库写入- 公共模块
def write_db(username, pwd):
    """ 数据库写入模块, 存在返回假，不存在写入

    :param username:  用户名
    :param pwd: 密码
    """
    if conf.has_option("register", username):
        return False
    conf.set("register", username, pwd)
    conf.write(open(setting.DB_PATH, "w"))
    return True
